{template 'common/header'}
{php load()->func('tpl')}
<ul class="nav nav-tabs">
	<li {if $op == 'post'}class="active"{/if}><a href="{php echo $this->createWebUrl('slide',array('op' => 'post'))}">添加</a></li>
	<li {if $op == 'display'}class="active"{/if}><a href="{php echo $this->createWebUrl('slide',array('op' => 'display'))}">管理</a></li>
</ul>
<style>
.table td span{display:inline-block;margin-top:4px;}
.table td input{margin-bottom:0;}
</style>
{if $op == 'display'}
<div class="main">
	<div class="panel panel-info">
		<div class="panel-heading">筛选</div>
		<div class="panel-body">
			<form action="" method="post" class="form-horizontal" role="form">
				<div class="form-group">
					<label class="col-xs-12 col-sm-2 col-md-2 control-label">关键字</label>
					<div class="col-sm-8 col-md-8 col-lg-8 col-xs-12">
						<input class="form-control" name="keyword" id="" type="text" value="{$_GPC['keyword']}">
					</div>
				</div>
				<div class="form-group">
					<div class="pull-right col-xs-12 col-sm-2 col-md-2 col-lg-2">
						<button class="btn btn-default"><i class="fa fa-search"></i> 搜索</button>
					</div>
				</div>
			</form>
		</div>
	</div>
	<div style="padding:15px;">
		<table class="table table-hover table-striped">
			<thead class="navbar-inner">
				<tr>
					<th width="100px;">排序</th>
					<th width="100px;">标题</th>
					<th>链接</th>
					<th style="width:85px; text-align:right;">操作</th>
				</tr>
			</thead>
			<tbody>
				{loop $list $item}
				<tr>
					<td><input type="text" class="form-control" name="displayorder[{$item['id']}]" value="{$item['displayorder']}" /></td>
					<td>
						{$item['title']}
					</td>
					<td><a href="{$item['url']}">{$item['url']}</a></td>
					<td style="text-align:right;">
						<a href="{php echo $this->createWebUrl('slide',array('op' => 'post','id' => $item['id']))}" title="编辑" class="btn btn-mini"><i class="glyphicon glyphicon-edit"></i></a>
						<a onclick="return confirm('此操作不可恢复，确认吗？'); return false;" href="{php echo $this->createWebUrl('slide',array('op' => 'delete', 'id' => $item['id']))}" title="删除" class="btn btn-mini"><i class="glyphicon glyphicon-remove-circle"></i></a>
					</td>
				</tr>
				{/loop}
			</tbody>
		</table>
		{$pager}
	</div>
</div>
<script type="text/javascript">
<!--
	var category = {php echo json_encode($children)};
//-->
</script>
{elseif $op == 'post'}
<div class="main">
	<form class="form-horizontal form" action="" method="post" enctype="multipart/form-data" onsubmit="return formcheck(this)">
		<input type="hidden" name="id" value="{$item[id]}">
		<div class="panel panel-default">
			<div class="panel-heading">
				幻灯片管理
			</div>
			<div class="panel-body">
				<div class="form-group">
					<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">排序</label>
					<div class="col-sm-10 col-xs-12">
						<input type="text" class="form-control" placeholder="" name="displayorder" value="{$item['displayorder']}">
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">标题</label>
					<div class="col-sm-10 col-xs-12">
						<input type="text" class="form-control" placeholder="" name="title" value="{$item['title']}">
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">缩略图</label>
					<div class="col-sm-10 col-xs-12">
						{php echo tpl_form_field_image('thumb', $item['thumb'])}
						<span class="help-block"></span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">链接</label>
					<div class="col-sm-10 col-xs-12">
						{php echo tpl_form_field_link('url', $item['url'], array('css' => array('input' => ' input-sm', 'btn' => ' btn-sm')));}
					</div>
				</div>
			</div>
		</div>
		<div class="form-group col-sm-12">
			<button type="submit" class="btn btn-primary col-lg-1" name="submit" value="提交">提交</button>
			<input type="hidden" name="token" value="{$_W['token']}" />
		</div>
	</form>
</div>
<script type="text/javascript">
<!--
	var category = {php echo json_encode($children)};
	kindeditor($('.richtext-clone'));
//-->
</script>
{/if}
{template 'common/footer'}
